import {
  MenuFoldOutlined,
  MenuUnfoldOutlined,
  UploadOutlined,
  UserOutlined,
  VideoCameraOutlined,
} from '@ant-design/icons';

import Dashboard from "@/pages/dashboard/index"
import GoodList from "@/pages/good/goodList"
import GoodForm from "@/pages/good/goodForm"
import User from "@/pages/user/index"
import Layout from "@/pages/layout"
import Login from "@/pages/login"

import { FormattedMessage } from "react-intl"

// 静态路由
export const constantRoutes = [
  // 根据用户的角色，计算出当前用户可访问的二级路由，放到children中
  { path: "/", element: <Layout />, children: [] },
  { path: "/login", element: <Login />, children: [] },
]

// 动态路由，有权限的路由
export const asyncRoutes = [
  {
    key: 1001,
    path: "/dashboard",
    label: <FormattedMessage id="menu.dashboard" />,
    icon: <MenuFoldOutlined />,
    element: <Dashboard />,
    meta: {
      roles: ["admin", "editor"]
    }
  },
  {
    key: 1002,
    icon: <VideoCameraOutlined />,
    label: <FormattedMessage id="menu.good" />,
    meta: {
      roles: ["editor", "admin"]
    },
    children: [
      {
        key: 100201,
        path: "/good/list",
        icon: null,
        label: <FormattedMessage id="menu.good.list" />,
        element: <GoodList />
      },
      {
        key: 100202,
        path: "/good/add",
        icon: null,
        label: <FormattedMessage id="menu.good.add" />,
        element: <GoodForm />
      },
      {
        key: 100203,
        path: "/good/edit",
        icon: null,
        label: <FormattedMessage id="menu.good.edit" />,
        element: <GoodForm />,
        hidden: true
      }
    ]
  },
  {
    key: 1003,
    path: "/user",
    element: <User />,
    icon: <UserOutlined />,
    label: <FormattedMessage id="menu.user" />,
    meta: {
      roles: ["admin", "editor"]
    }
  }
];